/*
 * @Description: 业务统计和书面反馈相关接口
 * @Author: Zzt
 * @Date: 2022-12-29 17:47:31
 * @LastEditTime: 2023-01-29 09:27:10
 */
import { IPageQuery } from '@/interfaces/global';
import request from '@/utils/request';
// 新增
export interface IAddGuidanceParams {
  attachmentJsonDTOS?: AttachmentJSONDTO[];
  description?: string;
  guidanceUnitId?: number;
  id?: number;
  instructedUnitId?: number;
  name?: string;
  remark?: string;
  type?: number;
}

export interface AttachmentJSONDTO {
  fileExt?: string;
  fileName?: string;
  fileNo?: number;
  filePath?: string;
  fileSize?: string;
  fileUrl?: string;
}
export function addGuidance(data: IAddGuidanceParams) {
  return request({
    url: `/message-business-guidance/`,
    method: 'post',
    data
  });
}
export interface IEditGuidanceParams extends IAddGuidanceParams {
  id: number;
}
// 修改
export function editGuidance(data: IEditGuidanceParams) {
  return request({
    url: `/message-business-guidance/`,
    method: 'put',
    data
  });
}

// 分页查询

export interface ISearchGuidanceParams {
  beginOperateTime?: string;
  beginReadTime?: string;
  beginSendTime?: string;
  endOperateTime?: string;
  endReadTime?: string;
  endSendTime?: string;
  guidanceUnitId?: number;
  instructedUnitId?: number;
  name?: string;
  operator?: number;
  operatorName?: string;
  readStatus?: number;
  sendStatus?: number;
  type?: number;
}

export function searchGuidanceByPage(data: IPageQuery<ISearchGuidanceParams>) {
  return request({
    url: `/message-business-guidance/page/`,
    method: 'post',
    data
  });
}
// 通过id查询

export function findGuidanceById(id: number | string) {
  return request({
    url: `/message-business-guidance/${id}`,
    method: 'get'
  });
}

// 通过id删除
export function deleteGuidanceList(id: number | string) {
  return request({
    url: `/message-business-guidance/${id}`,
    method: 'delete'
  });
}
/* 发送 */
export function sendGuidanceById(id: number | string) {
  return request({
    url: `/message-business-guidance/sendInstructions/${id}`,
    method: 'post'
  });
}
/* 查看 */
export function readGuidanceById(id: number | string) {
  return request({
    url: `/message-business-guidance/view/${id}`,
    method: 'post'
  });
}
